package com.green.common.fusionchart;

import java.util.ArrayList;
import java.util.List;

import com.green.common.fusionchart.enums.DefaultColorEnum;

public class MSLine extends Chart {
	

	public void setDataSets(List<DataSet> dataSets) {
		setColorForSet(dataSets, null);
		super.setDataSets(dataSets);
	}
	
	public void setDataSets(List<DataSet> dataSets, List<DefaultColorEnum> colors){
		setColorForSet(dataSets, colors);
		super.setDataSets(dataSets);
	}

	public void setColorForSet(List<DataSet> sets, List<DefaultColorEnum> colors) {
		if(colors == null || colors.size() == 0){
			colors = new ArrayList<DefaultColorEnum>();
			for(DefaultColorEnum color : DefaultColorEnum.values()){
				colors.add(color);
			}
		}
		int i = 0;
		for(DataSet set : sets){
			set.setColor(colors.get(i).getColor());
			i++;
			if(i == colors.size())
				i = 0;
		}
	}
}
